/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jp.co.irep.juten.entity;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author toan_nguyen
 */
@Entity
@Table(name = "catalog_theme")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CatalogTheme.findAll", query = "SELECT c FROM CatalogTheme c"),
    @NamedQuery(name = "CatalogTheme.findByCatalogId", query = "SELECT c FROM CatalogTheme c WHERE c.catalogThemePK.catalogId = :catalogId"),
    @NamedQuery(name = "CatalogTheme.findByThemeId", query = "SELECT c FROM CatalogTheme c WHERE c.catalogThemePK.themeId = :themeId")})
public class CatalogTheme implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CatalogThemePK catalogThemePK;

    public CatalogTheme() {
    }

    public CatalogTheme(CatalogThemePK catalogThemePK) {
        this.catalogThemePK = catalogThemePK;
    }

    public CatalogTheme(int catalogId, int themeId) {
        this.catalogThemePK = new CatalogThemePK(catalogId, themeId);
    }

    public CatalogThemePK getCatalogThemePK() {
        return catalogThemePK;
    }

    public void setCatalogThemePK(CatalogThemePK catalogThemePK) {
        this.catalogThemePK = catalogThemePK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (catalogThemePK != null ? catalogThemePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CatalogTheme)) {
            return false;
        }
        CatalogTheme other = (CatalogTheme) object;
        if ((this.catalogThemePK == null && other.catalogThemePK != null) || (this.catalogThemePK != null && !this.catalogThemePK.equals(other.catalogThemePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jp.co.irep.tech.juten.jpa.entity.CatalogTheme[ catalogThemePK=" + catalogThemePK + " ]";
    }
    
}
